<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
  <div region="center" style="padding:0px;border:0px">
  <t:datagrid name="dictCategoryList" checkbox="true" fitColumns="true" title="实验类别字典" actionUrl="trainItemController.do?datagrid" idField="id" fit="true" queryMode="group">
   <t:dgCol title="主键"  field="id"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="创建日期"  field="createDate" formatter="yyyy-MM-dd" hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="培训名称"  field="trainningName"   query="true" queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="是否发布"  field="isPub"  formatterjs="getIsPub"  queryMode="single"  width="60"></t:dgCol>
   <t:dgCol title="培训工种"  field="teachItem.itemName"   query="true" queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="实验室"  field="lab.name"   query="false" queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="开始报名日期"  field="startEnterDate" formatter="yyyy-MM-dd" queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="结束报名日期"  field="endEnterDate" formatter="yyyy-MM-dd"   queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="报名人数"  field="enterCount" hidden="true" queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="报名人数"  field="maxEnterCount" hidden="true" queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="报名人数"  field="peopleCount" formatterjs="getPeopleCount" hidden="false" queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="操作" field="opt" width="160"></t:dgCol>
   <t:dgFunOpt  funname="editItemDetail({'编辑'},{'trainItemController.do?goUpdate'},id,{'560'},{'280'})" title="编辑" exp="isPub#eq#0" />
   <t:dgFunOpt  funname="goUpload(id)" title="上传资料"  />
   <t:dgFunOpt  funname="pubItem(id)" title="发布"  exp="isPub#eq#0"/>
   <t:dgFunOpt  funname="goSetExam(id)" title="设置考试题目" />   
   <t:dgDelOpt title="删除" url="trainItemController.do?doDel&id={id}"/>
   <t:dgToolBar title="录入" icon="icon-add" url="trainItemController.do?goAdd" funname="add" height="280" width="560"></t:dgToolBar>
   </t:datagrid>
  </div>
 </div>
 <script type="text/javascript">
 $(document).ready(function(){
 		//给时间控件加上样式
 		$("#dictGroupListtb").find("input[name='createDate']").attr("class","Wdate").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
 });
 
 function goSetExam(id){
	 window.location.href="trainQuestionController.do?list&trainItemId="+id;
 }
 
function getPeopleCount(v,rec){
	return rec['enterCount']+"/"+rec['maxEnterCount'];
}

function goUpload(id){
	var url = "trainItemController.do?goUploadPage&id="+id;
	createwindow("上传资料",url,600,400);
}

function getIsPub(v,rec){
	if(v==0){
		return '未发布';
	}else{
		return '已发布';
	}
}

function pubItem(id){
	$.dialog.confirm('确定要发布培训项目吗？',function(r){
		if(r){
			$.ajax({
				url:"trainItemController.do?pubItem&id="+id,
				success:function(d){
					d = $.parseJSON(d);
					tip(d.msg)
					if(d.success){
						reloadTable();
					}
				}
			});
		}
	});
}

//导出
function ExportXls() {
	JeecgExcelExport("trainItemController.do?exportXls","dictCategoryList");
}

//模板下载
function ExportXlsByT() {
	JeecgExcelExport("trainItemController.do?exportXlsByT","dictCategoryList");
}
 </script>